import sequelize from 'sequelize';
import { dbInstance } from '../db/config.js';
import { attributes, options } from '../shared/sequelize.js';
import Page from './page.js';

const projectAttrs = Object.assign({
  desc: {
      type: sequelize.DataTypes.TEXT,
      allowNull: false
  },
  coverUrl: {
      type: sequelize.DataTypes.STRING,
      allowNull: false
  }
}, attributes);

const Project = dbInstance.define('project', projectAttrs, options);

Project.hasMany(Page);

export default Project;
